<?	session_start();
	include_once("../include/function/functRandAscii.php");
	//$keycode=$_SESSION["keycode"];
	if(!$_GET["min"])
	{	$keycode=random(4,6);
		$_SESSION["keycode"]=$keycode;
    }
	$keycode=$_SESSION["keycode"];	
	header("Content-type: image/jpg");
	//$FONT_PATH=getcwd();
	$FONT_PATH="../include/font";
	$min=($_GET["min"]==""?16:(int)$_GET["min"]);
	$max=($_GET["max"]==""?16:(int)$_GET["max"]);
	$size=rand($min,$max);
	$fontfile="$FONT_PATH/arial.ttf";
	$width=($_GET["width"]!=""?(int)$_GET["width"]:160);
	$height=($_GET["height"]!=""?(int)$_GET["height"]:80);
	
	$im = imagecreate($width, $height);

	$red_bg=rand(192,255);
	$green_bg=rand(192,255);
	$blue_bg=rand(192,255);
        $bg_color = imagecolorallocate($im, 0xF9,0xF8,0xF7);
	$text_color = imagecolorallocate($im, rand(0,120), rand(0,100), rand(0,100));
	$ptpn11_color=imagecolorallocate($im,0x00,0x33,0x00);
        $col_ellipse = imagecolorallocate($im, 255, 255, 255);
	imagettftext($im,$size,0,$width-$size*7,$size*1.7+20,$text_color,$fontfile,$keycode);
	//imagestring($im,6,20,30,$keycode,$text_color);
	$text_color = imagecolorallocate($im, rand(0,128), rand(0,128), rand(0,128));
	$black = imagecolorallocate($im, 0, 0, 0);
	$green = imagecolorallocate($im, 00, 66, 00);
	
	imagettftext($im,8,0,$width/2-35,$height-5,$ptpn11_color,$fontfile,"zaqi@2005");
	imagettftext($im,8,0,$width/2-20,15,$ptpn11_color,$fontfile,"keycode");
	imagerectangle($im,2,20,$width-2,$height-20,$ptpn11_color);
	imagerectangle($im,2,$height-18,$width-2,$height-2,$ptpn11_color);
	$black = imagecolorallocate($im, 0, 0, 0);

	//imageline($im, rand(5,20), rand(($height/3),($height*3/4)), rand($width-5,$width-20), rand(($height/3),($height*3/4)), $black);
	imageline($im, rand(5,20), rand(($height/3),($height*3/4)), rand($width-5,$width-20), rand(($height/3),($height*3/4)-5), $green);
	$m=rand(150,300);
	for($j=0;$j<$m;$j++){
		    imagesetpixel($im,rand(10,$width-10),rand(25,$height-20),rand(0,255));
	}

	imagejpeg($im);
	imagedestroy($im);
?>